import { bodyParser } from "@koa/bodyparser";
import Koa from "koa";
import errorHandlingMiddleware from "@/middlewares/error-handling";
import routes from "@/routes";

const app = new Koa();
app.use(bodyParser());
app.use(errorHandlingMiddleware);
app.use(routes.routes()).use(routes.allowedMethods());

const port = 3000;
app.listen(port, () => {
  console.log(`server listening ${port}`);
});
